package com.mxchip.livestarmobile.mobile.av.player;

import android.graphics.SurfaceTexture;
import android.opengl.GLSurfaceView;

import com.mxchip.hxb3288a.av.player.OnSurfaceCreatedHandler;

public abstract class AbsSubRenderer implements GLSurfaceView.Renderer {

    protected OnSurfaceCreatedHandler onSurfaceCreatedHandler;

    protected float[] matrix = new float[16];

    public void setMatrix(float[] data) {
        if(data != null && data.length == 16) {
            System.arraycopy(data, 0, matrix, 0, data.length);
        }
    }

    /*public float[] getMatrix() {
        float[] data = new float[16];
        System.arraycopy(matrix, 0, data, 0, matrix.length);
        return data;
    }*/

    public void setOnSurfaceCreatedHandler(OnSurfaceCreatedHandler onSurfaceCreatedHandler) {
        this.onSurfaceCreatedHandler = onSurfaceCreatedHandler;
    }

    public OnSurfaceCreatedHandler getOnSurfaceCreatedHandler() {
        return onSurfaceCreatedHandler;
    }


    protected OnRenderListener mOnRenderListener;

    public void setOnRenderListener(OnRenderListener onRenderListener) {
        this.mOnRenderListener = onRenderListener;
    }

    abstract public SurfaceTexture getSurfaceTexture();

    abstract public void clearSurfaceTexture();

    public abstract void release();
}
